package com.hbnu.system.controller;


import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.entity.Identifyproject;
import com.hbnu.system.service.IIdentifyprojectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2023-05-16
 */
@RestController
@RequestMapping("/identifyproject")
@Api(tags = "成果鉴定关联项目模块")
public class IdentifyprojectController {
    @Autowired
    IIdentifyprojectService identifyprojectService;

    @ApiOperation("成果鉴定关联项目添加")
    @PostMapping("/AddIdentifyProject")
    public Rest<Boolean> AddIdentifyProject(@RequestBody Identifyproject identifyproject){
        boolean add = identifyprojectService.addIdentifyProject(identifyproject);
        return add ? Rest.success() : Rest.failed();
    }

    @ApiOperation("成果鉴定关联项目删除")
    @GetMapping("/RemoveIdentifyProject")
    public Rest<Boolean> RemoveIdentifyProject(String paperProjectID){
        boolean remove = identifyprojectService.removeIdentifyProject(paperProjectID);
        return remove ? Rest.success() : Rest.failed();
    }

    @ApiOperation("成果鉴定关联项目更新")
    @PostMapping("/UpdateIdentifyProject")
    public Rest<Boolean> UpdateIdentifyProject(@RequestBody Identifyproject identifyproject){
        boolean update = identifyprojectService.updateIdentifyProject(identifyproject);
        return update ? Rest.success() : Rest.failed();
    }

    @ApiOperation("成果鉴定关联项目查询")
    @GetMapping("/GetIdentifyProjectByidentifyID")
    public Rest<List<Identifyproject>> GetIdentifyProjectByidentifyID(String identifyID){
        List<Identifyproject> identifyProjectByidentifyID = identifyprojectService.getIdentifyProjectByIdentifyID(identifyID);
        return Rest.success(identifyProjectByidentifyID);
    }
}

